<?php
/**
* 消息数据模型
* @date: 2018年6月5日 上午10:12:44
* @author: xiaocui
*/

namespace app\admin666\model;

use think\Model;

class AuthGroup extends Model
{
    protected $validate = [
        'rule' => [
            'title' => 'length:1,30'
        ],
    
        'msg' => [
            'title.length' => '名称不能为空'
        ]
    ];
    
    public function lists(){
        return $this->field('id,title')->select();
    }
    
    public function getRules($type=0, $is_ts=0){
        if($type>0){
            $map['type'] = $type;
            $map['id'] = ['not in','25,26,27'];
        }
        
        $map['is_dev'] = '0';
        $menu = model('Menu')->where($map)->select();
        $nmenu = [];
        foreach($menu as $key=>$val){
            $val['rule_id'] = $val['id'];
            $nmenu[] = $val;
        }
    
        return $nmenu;
    }
}